import * as step from '@flow-step/step-toolkit'
import process from 'process'
import { installPython} from './execute-step'
const ENV_NAME_PYTHON_VERSION: string = 'CI_RUNTIME_VERSION'

async function runStep(): Promise<void> {
    const inputPythonVersion: string | undefined =
        process.env[ENV_NAME_PYTHON_VERSION]

    if (inputPythonVersion == undefined) {
        throw new Error('missing env CI_RUNTIME_VERSION')
    }

    await installPython(inputPythonVersion);
}

runStep()
    .then(function () {
        step.info('run step successfully!')
    })
    .catch(function (err: Error) {
        step.error(err.message)
        process.exit(-1)
    })
